package com.login.learn.controller;

import com.login.learn.WebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 乔巴
 * 2022-09-05 19:29
 */
@Controller
@RequestMapping("/api/test")
public class TestController {
    @Autowired
    WebSocketServer socketServer;
    /**
     * 启动页面
     * @return
     */
    @RequestMapping("/socket")
    public String start(){
        return "websocket";
    }
    @GetMapping("/send")
    public void send(){
        socketServer.sendMessage("hhhhhh");
    }

}
